#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	if (b >= a * c)
		cout << n * a;
	else
		cout << min(n / c * b + n % c * a, (n / c + 1) * b);
	return 0;
}
